package com.hwc.demo.myribbonrule;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;

@Configuration
public class MyRibbonRule {
	private final Logger logger = LoggerFactory.getLogger(MyRibbonRule.class);
	@Bean
	public IRule randomRule() {
		logger.info(">> ribbon use RandomRule instead of default");
		return new RandomRule(); //使用随机策略，不用默认的策略
	}
}
